package com.zhentao.controller;

import com.zhentao.model.common.app.dto.AgistDto;
import com.zhentao.model.common.app.dto.LoginDto;
import com.zhentao.model.common.app.pojo.ApUser;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.ApUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 861501
 */
@RequestMapping("/app/log")
@RestController
@Slf4j
@Api(tags = "user",description = "该controller的描述")
public class ApUserController {
    @Resource
    private ApUserService apUserService;
    @PostMapping("/in")
    public ResponseResult login(@RequestBody LoginDto loginDto){
       return apUserService.login(loginDto);
    }
    @PostMapping("/regist")
    public ResponseResult regist(@RequestBody AgistDto agistDto){
        return apUserService.regist(agistDto);
    }
    @ApiOperation("用户端：根据id查询用户")
    @GetMapping("/findId/{id}")
    public ResponseResult findId(@PathVariable("id") Integer id){
        return apUserService.findById(id);
    }
    @ApiOperation("用户端：修改")
    @PostMapping("/update")
    public ResponseResult update(@RequestBody ApUser apUser){
        return apUserService.update1(apUser);
    }
}
